package dk.dashboardFP.interactionElementFramwork {
	tv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElementtv.partofthegame.interactionElementFramwork.tv.partofthegame.interactiotv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElements.buttonViews.LabelButtonViewutElement.Ttv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElements.buttonViews.TestButtonViewViews.Labeltv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElements.buttons.AbstractButtonuttonViews.tv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElements.buttons.EButtonTypesents.buttontv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElements.buttons.ELabelButtonTypess.buttons.Etv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElements.buttons.GraphicButton.buttons.ELtv.partofthegame.interactionElementFramwork.tv.partofthegame.interactionElements.buttons.LabelButtonements.buttons.GraphicButton;
	import dk.dashboardFP.interactionElementFramwork.buttonViews.TestButtonView;
	import dk.dashboardFP.interactionElementFramwork.buttonViews.LabelButtonView;
	import dk.dashboardFP.interactionElementFramwork.buttons.GraphicButton;
	import dk.dashboardFP.interactionElementFramwork.buttons.ELabelButtonTypes;
	import dk.dashboardFP.interactionElementFramwork.buttons.LabelButton;
	import dk.dashboardFP.interactionElementFramwork.buttons.EButtonTypes;
	import dk.dashboardFP.interactionElementFramwork.buttons.AbstractButton;
	import dk.dashboardFP.interactionElementFramwork.inputElement.TextInput;
	import dk.dashboardFP.interactionElementFramwork.inputElement.EInputObjectTypes;
	import dk.dashboardFP.interactionElementFramwork.inputElementViews.TextInputView;

	/**
	 * @author jk
	 */
	public class IEFactory {

		private static var _oInstance : IEFactory;
		private static var _bCreatingInstance : Boolean = false;

		public function IEFactory() {
			if( !_bCreatingInstance ) throw new Error("Singleton and can only be accessed through IEFactory.get_oInstance()");
		}

		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		// button factory
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

		public static function get_doButton(sButtonType : String) : AbstractButton {
			switch(sButtonType) {
				case EButtonTypes.TEST:
					return new GraphicButton(new TestButtonView());
					break;
			}
			return null;
		}

		public static function get_doLabelButton(sLabelButtonType : String, sText : String, intIcontIndex : int = 0) : LabelButton {
			
			var doLB : LabelButton;
			
			switch(sLabelButtonType) {
				case ELabelButtonTypes.DEFAULT:
					doLB = new LabelButton(new LabelButtonView());
					break;	
			}
			
			doLB.doLabel.sText = sText;
			doLB.intIconIndex = intIcontIndex;
			
			return doLB;
		}

		public static function get_doTextInput(sInputObjetType : String) : TextInput {
			
			switch(sInputObjetType) {
				case EInputObjectTypes.SINGLE_LINE_INPUT:
				return new TextInput(new TextInputView());
					break;
			}
			
			return null;
		}

		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		// sectionName
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

		public static function get_oInstance() : IEFactory {
			if (!_oInstance) {
				_bCreatingInstance = true;
				_oInstance = new IEFactory();
				_bCreatingInstance = false;
			}
			return _oInstance;
		}
	}
}
